<script tpye="text/javascript">

function foo(){

    for (let index = 0; index < arguments.length; index++) {
        const element = arguments[index];
        console.log(element)
        
    }
}
foo(10,10,20,30,30,3040)


// 形参 实参 值的复制

var out = 0 
function add(x){
    out += x
}
add(10)
console.log("out=",out)



//写个递归玩玩
var tmp = 1
function fooo(x){
    if (x < 999) {
        console.log("目前执行到第",tmp,"次 x=",x)
        x += 99
        tmp += 1 
        fooo(x)
    }else{
        
    }
}
fooo(1)

//数组
var num_list =  [1,2,3,3,4,5]



//数组的方法
num_list.push("hhaha")
num_list.push("nihao")

// 头部添加 shift  pop头部 unshift
console.log(num_list.pop())



console.log(num_list,num_list.length,)
num_list.forEach(element => {
    console.log(element)
});

//字符串

console.log("sdads".indexOf("s"))
console.log("sdads".search("s"))

var old = "asdzxc"
var new1 = old.substring(2,4)
console.log(new1)

var ran = Math.random()
alert(ran )
alert(parseInt(ran*10))
</script>